package com.ruoyi.system.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqExchangeConfig {


    @Bean
    public Queue ActivityQueue(){
        return new Queue("activityQueue");
    }

    @Bean
    public Queue signQueue(){
        return new Queue("signQueue");
    }

    @Bean
    public Queue emailQueue(){
        return new Queue("mailQueue");
    }



    @Bean
    public Queue delayQueue(){
        return new Queue("delayQueue");
    }

    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("topicExchange");
    }


    @Bean
    Binding bindingExchangeMessage1() {
        return BindingBuilder.bind(ActivityQueue()).to(topicExchange()).with("topic.activity.#");
    }

    @Bean
    Binding bindingExchangeMessage2() {
        return BindingBuilder.bind(delayQueue()).to(topicExchange()).with("topic.delay.delay");
    }
    @Bean
    Binding bindingExchangeMessage3() {
        return BindingBuilder.bind(signQueue()).to(topicExchange()).with("topic.sign.sign");
    }

    @Bean
    Binding bindingExchangeMessage4() {
        return BindingBuilder.bind(emailQueue()).to(topicExchange()).with("topic.email.qqMail");
    }

}
